window.onload = function() {
// 当网页向下滑 "返回顶部"
    var mybtn = document.getElementById("myBtn");
    var timer = null;

    window.onscroll = function () {
        var sT = document.documentElement.scrollTop || document.body.scrollTop;
        if (sT >= 800) {
            mybtn.style.display = 'block';
        } else {
            mybtn.style.display = 'none';
        }

    };
    mybtn.onclick = function () {
        clearInterval(timer);
        timer = setInterval(function () {

            document.documentElement.scrollTop -= 100;
            document.body.scrollTop -= 100;
            var sT = document.documentElement.scrollTop || document.body.scrollTop;
            if (sT <= 0) {
                clearInterval(timer);
            }

        }, 30)
    };



};



